load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "instancestorage",
    srcs = [
        "instancecache.go",
        "instancereader.go",
        "instancestorage.go",
        "row_codec.go",
        "test_helpers.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/sqlinstance/instancestorage",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/clusterversion",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/rangefeed",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/concurrency/lock",
        "//pkg/multitenant",
        "//pkg/roachpb",
        "//pkg/server/settingswatcher",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catsessiondata",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/enum",
        "//pkg/sql/regionliveness",
        "//pkg/sql/rowenc/keyside",
        "//pkg/sql/rowenc/valueside",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sqlinstance",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqlliveness/slstorage",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/json",
        "//pkg/util/log",
        "//pkg/util/retry",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "instancestorage_test",
    srcs = [
        "helpers_test.go",
        "instancecache_test.go",
        "instancereader_test.go",
        "instancestorage_internal_test.go",
        "instancestorage_test.go",
        "main_test.go",
        "row_codec_test.go",
    ],
    embed = [":instancestorage"],
    deps = [
        "//pkg/base",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvtenant",
        "//pkg/kv/kvclient/rangefeed",
        "//pkg/kv/kvserver",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/server/settingswatcher",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/enum",
        "//pkg/sql/sqlinstance",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqlliveness/slstorage",
        "//pkg/sql/sqlliveness/sqllivenesstestutils",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/encoding",
        "//pkg/util/grpcutil",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
